#include<bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
namespace IO{
	template<typename T>
	void read(T &x){
		char ch=getchar();int fl=1;x=0;
		while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getchar();}
		while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getchar();}
		x*=fl;
	}
	template<typename T,typename ...Args>
	void read(T &x,Args& ...args){
		read(x);read(args...);
	}
	template <typename _Tp>
	void write(_Tp x) {
		if(x<0) x=(~x+1),putchar('-');
		if(x>9) write(x/10);
		putchar(x%10+'0');
	}
}
using namespace IO;
const int Maxn = 1000010;
int n;
int h[Maxn], r[Maxn], R[Maxn];
double k[Maxn];
double ans[Maxn];
int stk[Maxn], st;
signed main(){
	ios::sync_with_stdio(false);
	freopen("wan.in", "r", stdin);
	freopen("wan.out", "w", stdout);
	read(n);
	for(int i = 1 ; i <= n ; i++){
		read(h[i], r[i], R[i]);
		k[i] = (double)(R[i] - r[i]) / h[i];
	}
	stk[++st] = 1;
	for(int i = 2 ; i <= n ; i++){
		for(int j = st ; j ; j--){
			int x = stk[j];
			double s = 0;
			if(r[i] <= r[x] && R[i] <= R[x]){
				double hi = (double)(R[i] - r[x]) / k[x];
				if(hi <= h[i]){
					ans[i] = max(ans[i], ans[x]);
					break;
				}
			}
			if(r[i] > R[x]){
				s = max(s, ans[x] + h[x]);
				ans[i] = s;
				continue;
			}
			// printf("%.9Lf\n", s);
			if(R[i] >= R[x]){
				double hi = (double)(R[x] - r[i]) / k[i];
				// printf("%.9Lf ", hi);
				s = max(s, ans[x] + h[x] - hi);
				ans[i] = s;
				continue;
			}
			
			if(r[i] >= r[x]){
				double hi = (double)(r[i] - r[x]) / k[x];
				s = max(s, ans[x] + hi);
				ans[i] = s;
				continue;
			}
			// printf("%.9Lf ", s);
			if(R[i] >= r[x]){
				double hi = (double)(R[i] - r[x]) / k[x];
				s = max(s, ans[x] + hi - h[i]);
			}
			// printf("%.9Lf ", s);
			ans[i] = max(ans[i], s);
		}
		while((double)ans[stk[st]] + 1.0 * h[stk[st]] <= (double)ans[i] + 1.0 * h[i] && st) st--;
		stk[++st] = i;
	}
	// for(int i = 1 ; i <= n ; i++) printf("%.9Lf ", ans[i]);
	// printf("\n");
	double Out = 0;
	for(int i = 1 ; i <= n ; i++) Out = max(Out, ans[i] + 1.0 * h[i]);
	printf("%.9Lf\n", Out);
	cerr << clock() * 1.0 / CLOCKS_PER_SEC << "sec" << '\n';
	return 0;
}
/*
2
40 10 50
60 20 30

*/